package com.uzai.console.web.md;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.dto.md.mdpageset.MdPageSetDto;
import com.uzai.console.dto.md.mdpageset.MdPageSetUserWelfareDto;
import com.uzai.console.dto.sysdomain.SysDomainQuery;
import com.uzai.console.entity.SysDomain;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.service.md.mdpageset.MdPageSetService;
import com.uzai.console.vo.base.SelectIdVo;
import com.uzai.console.vo.base.SelectKeyForMdPageSetVo;
import com.uzai.console.vo.base.SelectKeyVo;
import com.uzai.console.vo.md.mdpageset.MdPageSetVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author liuqi
 * @date 2021年08月25日 20:15
 */
@Api(value = "免单页面设置",tags = "免单管理|免单页面设置")
@ApiSort(60)
@RestController
public class MdPageSetContoller extends BaseController {
    private Logger logger = LoggerFactory.getLogger(MdPageSetContoller.class);

    @Autowired
    private MdPageSetService mdPageSetService;

    @ApiOperation(value = "查询免单页面设置信息", notes = "查询免单页面设置信息", response = MdPageSetVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/mdPageSet/findMdPageSet")
    public Object findMdPageSet(){
        return mdPageSetService.findMdPageSet(getLoginInfo().getMerId());
    }

    @SystemLogType(model = SystemModelEnum.CmsBase, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "保存免单页面设置信息", notes = "保存免单页面设置信息")
    @ApiOperationSupport(order = 2)
    @PostMapping("/mdPageSet/updateCmsBase")
    public Object updateCmsBase(@RequestBody MdPageSetDto mdPageSetDto){
        mdPageSetService.updateMdPageSet(mdPageSetDto);
        return true;
    }

    @ApiOperation(value = "免单页面设置查询新会员福利跳转下拉框列表", notes = "免单页面设置查询新会员福利跳转下拉框列表", response = SelectKeyForMdPageSetVo.class)
    @ApiOperationSupport(order = 3)
    @PostMapping("/mdPageSet/findNewUserWelfareUrlListSelect")
    public Object findNewUserWelfareUrlListSelect(@RequestBody MdPageSetUserWelfareDto mdPageSetUserWelfareDto){
        return mdPageSetService.findNewUserWelfareUrlListSelect(mdPageSetUserWelfareDto);
    }

}
